import time

# 时间戳：1970-1-1-0-0-0
time.time()
time.localtime().tm_year  # 本地当前时间
time.localtime().tm_hour
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
time.strptime('2018-10-10 17:55:39', '%Y-%m-%d %H:%M:%S')
time.strptime('2018-10-10 17:55:39', '%Y-%m-%d %H:%M:%S').tm_year

time.sleep(5)  # 休眠

import datetime

# 当前时间
datetime.datetime.now()
datetime.datetime.now().day
# 将时间戳转换为日期
datetime.datetime.fromtimestamp(1539165199.5232108)
# 当前时间 +3 天
datetime.datetime.now() + datetime.timedelta(3)
datetime.datetime.now() + datetime.timedelta(hours=3)

